package com.opennetexam.manager.mapper;

import com.opennetexam.manager.databasemodel.ExamingMonitorLog;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author 奶茶
 * Created on 2017/11/16.
 */
@Mapper
public interface ExamingMoniterLogMapper {

    @Insert("INSERT INTO ExamingMonitorLog (ExamineeArrangeID,TypeID,LogTime,Memo,Reason) VALUES(#{examineeArrangeID},#{typeID},NOW(),#{memo},#{reason})")
    Integer insertLog(ExamingMonitorLog examingMonitorLog);

    @Delete("DELETE eml FROM ExamingMonitorLog eml \n" +
            "LEFT JOIN ExamineeArrange ea on eml.ExamineeArrangeID = ea.ExamineeArrangeID " +
            "WHERE ea.AppID = #{appID} AND ea.ExamPlanInfoID = #{examPlanInfoID}")
    void deleteExamingMoniterLogByEAIds(@Param("examPlanInfoID") String examPlanInfoID, @Param("appID") String appID);

    @Select("SELECT * FROM ExamingMonitorLog WHERE ExamineeArrangeID = #{arrangeId}")
    List<ExamingMonitorLog> findListByArrangeId(@Param(value = "arrangeId") String arrangeId);


}
